<script>
	import {GYZJMODEL as gyzjModel}from './utils/gyzjModel.js'
	import {Page_Config as pageConfig} from './utils/config.js';
	// import APPUpdate from "./js_sdk/zhouWei-APPUpdate/APPUpdate/index.js";
	/*环信代码的开始*/
	require("./sdk/libs/strophe");
	let msgStorage = require("./comps/chat/msgstorage");
	let msgType = require("./comps/chat/msgtype");
	
	let disp = require("./utils/broadcast");
	let logout = false;
	let is_reconnect = false;
	/*环信代码的结束*/
    export default {
       /* onLaunch: function() {
            console.log('App Launch');
            // #ifdef APP-PLUS
            // 锁定屏幕方向
            plus.screen.lockOrientation('portrait-primary'); //锁定
            // 检测升级
            uni.request({
                url: 'https://uniapp.dcloud.io/update', //检查更新的服务器地址
                data: {
                    appid: plus.runtime.appid,
                    version: plus.runtime.version,
                    imei: plus.device.imei
                },
                success: (res) => {
                    console.log('success', res);
                    if (res.statusCode == 200 && res.data.isUpdate) {
                        let openUrl = plus.os.name === 'iOS' ? res.data.iOS : res.data.Android;
                        // 提醒用户更新
                        uni.showModal({
                            title: '更新提示',
                            content: res.data.note ? res.data.note : '是否选择更新',
                            success: (showResult) => {
                                if (showResult.confirm) {
                                    plus.runtime.openURL(openUrl);
                                }
                            }
                        })
                    }
                }
            })

            var domModule = weex.requireModule('dom');
            domModule.addRule('fontFace', {
                'fontFamily': "uniicons",
                'src': "url('./static/uni.ttf')"
            });
            // #endif
        }, */
       globalData:{
			selectMember:null,
       			userInfo: null,
       			token: null,
       			path: '',
       			scene:null,
       			query:'',  //分享时带的参数
       			merchantToken:null,
				mobile:null,//用户手机号码
				inviteCode:"",  //用戶分享的code
				nim:'',  //网易云im的实例
				chatroomServer: ["https://wlnimsc1.netease.im:443"], // 聊天服务器地址
				prevtoken:'test123',   //网易云的一个token,这里需要设置不为空
				chooseMember:null,//选择提醒的人
				reconnectionAttempts: 0, // 重连次数
				inChatroom: false, // 进入房间标志
				chatroomInstance: null, //聊天室的实例
				pageConfig:pageConfig,  //网易im之前的配置
				/*环信参数配置的开始*/
				unReadMessageNum: 0,
				saveFriendList: [],
				saveGroupInvitedList: [],
				groupList: [],
				isIPX: false ,//是否为iphone X
				/*环信参数配置的结束*/
       		},
       		onLaunch: function(options) {
				
				// console.log('pageConfig的值',pageConfig);
				// let property={};
				// console.log('对象定义属性的开始');
				// property.name='cover';
				// property['name']='cover1';
				// Object.defineProperty(property,'name',{value:'cover2',configurable:false});
				// console.log('property的值',property);
				// console.log('对象定义属性的结束');
				// APPUpdate();
				// uni.getProvider({
				//     service: 'push',
				//     success: function (res) {
				//         console.log(res.provider)
				//         // 个推的名称为 igexin
				//         if (~res.provider.indexOf('igexin')) {
				//             uni.subscribePush({
				//                 provider: 'igexin',
				//                 success: function (res) {
				//                     console.log('success:' + JSON.stringify(res));
				//                 }
				//             });
				//         }
				//     }
				// });
				// var info=plus.push.getClientInfo();
				// var cid=info.clientid;//客户端标识
				// alert(JSON.stringify(info));
				// alert(cid);
				// uni.connectSocket({
				// 	url:'http://www.baidu.com'
				// })
				// /*监听收到的信息开始*/
				// uni.onSocketMessage(function(res){
				// 	console.log('a收到服务器内容:'+res.data);
				// })
				/*监听收到的信息结束*/
				/*检测推送的方法*/
				/*检测更新app的方法 全局更新 自己写的方法*/
					 var url='https://m.zxgyzj.com/app/update';
					 console.log('url的值a',url);
					 var req = { //升级检测数据  
						 "appid": plus.runtime.appid,  
						 "version": plus.runtime.version  
					 };
					 console.log('reqa開始的值aaaa',req);
					 uni.request({
						 url:url,
						 data:req,
						 success:res=>{
							 let resData=res.data.data;
							  console.log('res的值a',res);
							   console.log('res的code值',res.statusCode);
							   console.log('res的data的status值',resData.status);
							 if(res.statusCode==200&&resData.status==1){
								 uni.showModal({
								 	title:'更新提示',
									content:resData.note,
									success:(data)=>{
										if(data.confirm){
											console.log('data的值',data);
											console.log('res的url值',resData.url);
											plus.runtime.openURL(resData.url);
										}
									}
								 })
							 }
						 },
						 fail:err=>{
							  console.log('fail的執行',fail);
						 },
						 complete:(msg)=>{
							 console.log('回調msg',msg);
						 }
					 })
					 /*检测更新app的方法 全局更新 自己写的方法*/
						
       			console.log('options的App值',options);
       			// uni.showLoading({
       			// 	title:'加载中....'
       			// })
       			let globalData=this.$options.globalData;
				console.log('所有的globalData的值',globalData);
				console.log('app.vue进来打印所有的globalData的值',globalData);
       			globalData.path=options.path;
       			globalData.query=options.query;
       			globalData.scene=options.scene; 
				var that=this;
				console.log('uni.getStorageSync(mobile)',uni.getStorageSync('mobile'));
				console.log('uni.getStorageSync(token)',uni.getStorageSync('token'));
				console.log('uni.getStorageSync(userInfo)',uni.getStorageSync('userInfo'));
				console.log('globaData的mobile值',globalData.mobile);
				console.log('globaData的token值',globalData.token);
				//第一次进来防止用户清除缓存拿不到用户数据
       			/*省略小程序更新代码*/
       			console.log('值的开始');
       			// this.login().then((res)=>{
       			// 	console.log('a1then的执行a',res);
       			// 	token=encodeURIComponent(res.data.token);
       			// 	globalData.token=token;
       			// 	uni.setStorageSync('token',token);
       			// 	this.getOurUserInfo(token);
       			// 	return this.getUserInfo();
       			// 	uni.hideLoading();
       			// }).then((res)=>{
       			// 	console.log('2then的执行',res);
       			// 	// let userInfo=res.userInfo;
       			// 	// delete userInfo.language;
       			// 	// return this.updataUserInfo(res.userInfo,this.token);
       			// }).then(()=>{
       			// 	
       			// }).catch((error)=>{
       			// 	console.log('执行App.vue onlaunch中的promise时，出现了错误');
       			// 	console.log(error);
       			// })
				/*通过手机号获取用户信息*/
				// this.getUserInfo(globalData);
				if(!uni.getStorageSync('mobile')&&!globalData.mobile){
					if(!uni.getStorageSync('token')&&!globalData.token){
						console.log('没有token进来');
						globalData.mobile='0739'; 
						/*这里电话0739也获取这条数据*/
						that.main_getUserInfo(globalData.mobile,2).then(res=>{
							globalData.userInfo=res.data.user;
							uni.setStorageSync("userInfo", res.data.user);
							uni.setStorageSync("myUsername", res.data.user.hx_username);
						});
						
					}else{
						console.log('执行了重新获取数据方法');
						/*如果有token的话需要实时得到token更新userInfo避免数据丢失*/
							let token=uni.getStorageSync('token')||globalData.token;
							/*不能在重新获取用户信息*/
							that.main_getUserInfo(token,1).then(res=>{
								console.log('执行了重新获取数据用户的值',res.data.user);
								globalData.userInfo=res.data.user;
								//进来老用户进来设置手机号码，是用来判断老用户登录方式的凭证
								globalData.mobile=res.data.user.mobile;
								uni.setStorageSync("userInfo", res.data.user);
								uni.setStorageSync("myUsername",res.data.user.hx_username);
							});
					}
				}else{
					let token=uni.getStorageSync('mobile')||globalData.mobile;
					/*不能在重新获取用户信息*/
					that.main_getUserInfo(token,2).then(res=>{
						console.log('执行了重新获取数据用户的值',res.data.user);
						globalData.userInfo=res.data.user;
						//进来老用户进来设置手机号码，是用来判断老用户登录方式的凭证
						globalData.mobile=res.data.user.mobile;
						uni.setStorageSync("userInfo", res.data.user);
						uni.setStorageSync("myUsername",res.data.user.hx_username);
					});
				}	
				
				/*环信代码的开始*/
				var me = this;
				var logs = uni.getStorageSync("logs") || [];
				logs.unshift(Date.now());
				uni.setStorageSync("logs", logs);
				
				disp.on("em.main.ready", function(){
					me.calcUnReadSpot();
				});
				//离开chatroom
				disp.on("em.chatroom.leave", function(){
					console.log('em.chatroom.leave');
					me.calcUnReadSpot();
				});
				disp.on("em.chat.session.remove", function(){
					me.calcUnReadSpot();
				});
				disp.on('em.chat.audio.fileLoaded', function(){
					me.calcUnReadSpot()
				});
				
				disp.on('em.main.deleteFriend', function(){
					me.calcUnReadSpot()
				});
				disp.on('em.chat.audio.fileLoaded', function(){
					me.calcUnReadSpot()
				});
				
				
				this.$im.conn.listen({
					onOpened: (message)=>{
						this.$im.conn.setPresence();
						console.log('a登录成功登录成功登录成功登录成功登录成功登录成功登录成功');
						/*每次登录获取所有群开始*/
						this.$im.conn.listRooms({
							success: function(rooms){
								console.log('成功获取的rooms',rooms);
								uni.setStorageSync('listGroup',rooms);
								// 新的方式全局设置
								this.$options.globalData.groupList = rooms || [];
							},
							error: function(){
								console.log('error的执行',error);
							}
						});
						/*每次登录获取所有群结束*/
						message.accessToken && uni.setStorageSync("myToken", message.accessToken);
						if (is_reconnect) {
							uni.hideToast();
							this.$helper.toast('success', '登陆成功', 2000)
							is_reconnect = false;
						}
						if(this.getCurrentRoute() == "pages/login/login" || getCurrentRoute() == "pages/login_token/login_token"){
							this.onLoginSuccess();
						}
						/*登录成功获取群详情*/
						
					},
					
					/*自定义的获取所有群结束*/
					onReconnect: ()=>{
						this.$helper.toast('loading', '重连中...', 2000)
					},
					onSocketConnected: ()=>{
						this.$helper.toast('success', '登陆成功', 2000)
					},
					onClosed: ()=>{
						this.$helper.toast('none', '网络已断开', 2000)
						// uni.redirectTo({
						// 	url: "../test/im-login-one"
						// });
						uni.redirectTo({
							url: "../login/login"
						});
						this.$conn.closed = true;
						this.$im.conn.close();
					},
					onInviteMessage: (message)=>{
						this.$options.globalData.saveGroupInvitedList.push(message);
						disp.fire("em.xmpp.invite.joingroup", message);
						// uni.showModal({
						// 	title: message.from + " 已邀你入群 " + message.roomid,
						// 	success(){
						// 		disp.fire("em.xmpp.invite.joingroup", message);
						// 	},
						// 	error(){
						// 		disp.fire("em.xmpp.invite.joingroup", message);
						// 	}
						// });
					},
					onPresence: (message)=>{
						console.log("onPresence", message);
						switch(message.type){
						case "unsubscribe":
							// pages[0].moveFriend(message);
							break;
						// 好友邀请列表
						case "subscribe":
							if(message.status === "[resp:true]"){
								return;
							}
							else{
								// pages[0].handleFriendMsg(message);
								for (let i = 0; i < this.$options.globalData.saveFriendList.length; i ++) {
							      	if(this.$options.globalData.saveFriendList[i].from === message.from){
							      		this.$options.globalData.saveFriendList[i] = message
							      		disp.fire("em.xmpp.subscribe");
										return;
							 		}
							    }
								this.$options.globalData.saveFriendList.push(message);
								console.log(JSON.stringify(this.$options.globalData.saveFriendList));
								disp.fire("em.xmpp.subscribe");
							}
							break;
						case "subscribed":
							uni.showToast({
								title: "添加成功",
								duration: 1000
							});
							disp.fire("em.xmpp.subscribed");
							break;
						case "unsubscribed":
							uni.showToast({
								title: "已拒绝",
								duration: 1000
							});
							break;
						case "memberJoinPublicGroupSuccess":
							this.$helper.toast('none', '已进群', 1000)
							break;
						// 好友列表
						// case "subscribed":
						// 	let newFriendList = [];
						// 	for(let i = 0; i < me.$options.globalData.saveFriendList.length; i++){
						// 		if(me.$options.globalData.saveFriendList[i].from != message.from){
						// 			newFriendList.push(me.$options.globalData.saveFriendList[i]);
						// 		}
						// 	}
						// 	me.$options.globalData.saveFriendList = newFriendList;
						// 	break;
						// 删除好友
						case "unavailable":
							disp.fire("em.xmpp.contacts.remove");
							disp.fire("em.xmpp.group.leaveGroup", message);
							break;
				
						case 'deleteGroupChat':
							disp.fire("em.xmpp.invite.deleteGroup", message);
							break;
				
						case "leaveGroup": 
							disp.fire("em.xmpp.group.leaveGroup", message);
							break;
				
						case "removedFromGroup": 
							disp.fire("em.xmpp.group.leaveGroup", message);
							break;
						// case "joinChatRoomSuccess":
						// 	uni.showToast({
						// 		title: "JoinChatRoomSuccess",
						// 	});
						// 	break;
						// case "memberJoinChatRoomSuccess":
						// 	uni.showToast({
						// 		title: "memberJoinChatRoomSuccess",
						// 	});
						// 	break;
						// case "memberLeaveChatRoomSuccess":
						// 	uni.showToast({
						// 		title: "leaveChatRoomSuccess",
						// 	});
						// 	break;
				
						default:
							break;
						}
					},
					onRoster: (message)=>{
						// let pages = getCurrentPages();
						// if(pages[0]){
						// 	pages[0].onShow();
						// }
					},
					onVideoMessage: (message)=>{
						console.log("onVideoMessage: ", message);
						if(message){
							msgStorage.saveReceiveMsg(message, msgType.VIDEO);
						}
						this.calcUnReadSpot(message);
						this.ack(message);
					},
					onAudioMessage: (message)=>{
						console.log("onAudioMessage", message);
						if(message){
							if(this.onMessageError(message)){
								msgStorage.saveReceiveMsg(message, msgType.AUDIO);
							}
							this.calcUnReadSpot(message);
							this.ack(message);
						}
					},
					onCmdMessage: (message)=>{
						console.log("onCmdMessage", message);
						if(message){
							if(this.onMessageError(message)){
								msgStorage.saveReceiveMsg(message, msgType.CMD);
							}
							this.calcUnReadSpot(message);
							this.ack(message);
						}
					},
					// onLocationMessage: (message)=>{
					// 	console.log("Location message: ", message);
					// 	if(message){
					// 		msgStorage.saveReceiveMsg(message, msgType.LOCATION);
					// 	}
					// },
					onTextMessage: (message)=>{
						console.log("onTextMessage", message);
						if(message){
							if(this.onMessageError(message)){
								msgStorage.saveReceiveMsg(message, msgType.TEXT);
							}
							this.calcUnReadSpot(message);
							this.ack(message);
						}
					},
					onEmojiMessage: (message)=>{
						console.log("onEmojiMessage", message);
						if(message){
							if(this.onMessageError(message)){
								msgStorage.saveReceiveMsg(message, msgType.EMOJI);
							}
							this.calcUnReadSpot(message);
							this.ack(message);
						}
					},
					onPictureMessage: (message)=>{
						console.log("onPictureMessage", message);
						if(message){
							if(this.onMessageError(message)){
								msgStorage.saveReceiveMsg(message, msgType.IMAGE);
							}
							this.calcUnReadSpot(message);
							this.ack(message);
						}
					},
					onFileMessage: (message)=>{
						console.log('onFileMessage', message);
						if (message) {
							if(this.onMessageError(message)){
								msgStorage.saveReceiveMsg(message, msgType.FILE);
							}
							this.calcUnReadSpot(message);
							this.ack(message);
						}
					},
					// 各种异常
					onError: (error)=>{
						console.log(error)
						// 16: server-side close the websocket connection
						if(error.type == this.$im.statusCode.WEBIM_CONNCTION_DISCONNECTED && !logout){
							if(this.$im.conn.autoReconnectNumTotal < this.$im.conn.autoReconnectNumMax){
								return;
							}
							uni.showToast({
								title: "server-side close the websocket connection",
								duration: 1000
							});
							// uni.redirectTo({
							// 	url: "../test/im-login-one"
							// });
							uni.redirectTo({
								url: "../login/login"
							});
							logout = true
							return;
						}
						// 8: offline by multi login   退出登录的页面，不过这里无法生效
						if(error.type == this.$im.statusCode.WEBIM_CONNCTION_SERVER_ERROR){
							// uni.showToast({
							// 	title: "offline by multi login",
							// 	duration: 1000
							// });
							uni.showToast({
								title: "您已在其他地方登录,请返回后重试!",
								duration: 1000
							});
							uni.redirectTo({
								url: "../login/login"
							});
							// uni.redirectTo({
							// 	url: "../index/index"
							// });
						}
						if(error.type ==  this.$im.statusCode.WEBIM_CONNCTION_OPEN_ERROR){
							disp.fire("em.xmpp.error.passwordErr");
							// uni.showModal({
							// 	title: "用户名或密码错误",
							// 	confirmText: "OK",
							// 	showCancel: false
							// });
						}
						if (error.type == this.$im.statusCode.WEBIM_CONNCTION_AUTH_ERROR) {
							disp.fire("em.xmpp.error.tokenErr");
						}
						if (error.type == 'socket_error') {///sendMsgError
							console.log('socket_errorsocket_error', error)
							uni.showToast({
								title: "网络已断开",
								icon: 'none',
								duration: 2000
							});
							disp.fire("em.xmpp.error.sendMsgErr", error);
						}
					},
				});

				// #ifdef H5
				if(!this.$im.conn.isOpened() && uni.getStorageSync("myToken") && uni.getStorageSync("myUsername")) {
					is_reconnect = true;
					this.$helper.toast('loading', '自动登陆中...', 10000, true);
					//尝试使用token重新登陆
					this.$conn.open({
						apiUrl: this.$im.config.apiURL,
						user: uni.getStorageSync("myUsername"),
						accessToken: uni.getStorageSync("myToken"),
						appKey: this.$im.config.appkey
					});
				}
				// #endif
				/*环信代码的结束*/
       		},
			/*发送数据的一些方式*/
			onUniNViewMessage:function(e){
			  console.log("App.vue收到数据")
			  console.log(JSON.stringify(e.data))  
			},
       		methods:{
				/*环信代码的开始*/
				/*登录成功的跳转页面*/
				onLoginSuccess(){
					uni.hideToast();
					// uni.switchTab({
					// 	url: "../chat/chat"
					// });
					uni.navigateTo({
						url: "../groups/groups"
					});
				},
				ack(receiveMsg){
					// 处理未读消息回执
					var bodyId = receiveMsg.id;         // 需要发送已读回执的消息id
					var ackMsg = new this.$im.message("read", this.$im.conn.getUniqueId());
					ackMsg.set({
						id: bodyId,
						to: receiveMsg.from
					});
					this.$im.conn.send(ackMsg.body);
				},
				onMessageError(err){
					if(err.type === "error"){
						uni.showToast({
							title: err.errorText
						});
						return false;
					}
					return true;
				},
				
				getCurrentRoute(){
					let pages = getCurrentPages();
					let currentPage = pages[pages.length - 1];
					return currentPage.route;
				},
				
				calcUnReadSpot(message){
					let myName = uni.getStorageSync("myUsername");
					let members = uni.getStorageSync("member") || []; //好友
					var listGroups = uni.getStorageSync('listGroup')|| []; //群组
					let allMembers = members.concat(listGroups)
					let count = allMembers.reduce(function(result, curMember, idx){
						let chatMsgs;
						if (curMember.roomId) {
							chatMsgs = uni.getStorageSync(curMember.roomId + myName.toLowerCase()) || [];
						}else{
							chatMsgs = uni.getStorageSync(curMember.name.toLowerCase() + myName.toLowerCase()) || [];
						}
						return result + chatMsgs.length;
					}, 0);
					this.$options.globalData.unReadMessageNum = count;
					disp.fire("em.xmpp.unreadspot", message);
				},
				/*环信代码的结束*/
     //   			login:function(){
					// var it=this;
					// var  getAppid = plus.runtime.appid;
					// console.log('it',it);
					// console.log('getAppid',getAppid);
     //   				return new Promise((resolve,reject)=>{
     //   					uni.login({
					// 		provider: 'weixin',  
     //   						success:res=>{
					// 			console.log(JSON.stringify(res))
     //   							console.log('res:',res);
					// 			console.log('res-code',res.code);
     //   							let data={
     //   								code:res.code,
     //   							};
     //   							const resolveData=gyzjModel.prototype.userLogin(data);
     //   							console.log('resolveData',resolveData);
     //   							resolve(resolveData);
     //   						}
     //   					})
     //   				})
     //   			},
			 //微信获取服务器个人信息,这里不用
       		  getOurUserInfo: function(token) {
       			console.log('获取个人信息11111111111111');
       			var that=this;
       			return new Promise((resolve, reject) => {
					
       			  gyzjModel.prototype.getUserInfo(token).then(res => {
       				console.log('获取个人信息');
       				uni.hideLoading();
       				// resolve(res);
       				let globalData=this.$options.globalData;
       				globalData.userInfo = res.data.user;
       				uni.setStorageSync("userInfo", res.data.user);
       				// this.isDefineRole(res.data.user.role)
       				// 由于 getUserInfo 是网络请求，可能会在 Page.onLoad 之后才返回
       				// 所以此处加入 callback 以防止这种情况
       				// if (this.userInfoReadyCallback) {
       				//   this.userInfoReadyCallback(res)
       				// }
       				// if(!res.data.user.nickName){
       				// 	that.jump;
       				// }
       				uni.hideLoading();
       			  })
       			})
       		  },
			  /*现在的getUserInfo*/
			  getUserInfo:function(){
				  console.log('准备执行');
				  if(!uni.getStorageSync('mobile')&&!globalData.mobile){
				  	if(!uni.getStorageSync('token')&&!globalData.token){
				  		console.log('没有token进来');
				  		globalData.mobile='0739'; 
				  	}else{
				  		console.log('执行了重新获取数据方法');
				  		/*如果有token的话需要实时得到token更新userInfo避免数据丢失*/
				  			let token=uni.getStorageSync('token')||globalData.token;
				  			/*不能在重新获取用户信息*/
				  			that.main_getUserInfo(token,1).then(res=>{
				  				console.log('执行了重新获取数据用户的值',res.data.user);
				  				globalData.userInfo=res.data.user;
				  				//进来老用户进来设置手机号码，是用来判断老用户登录方式的凭证
				  				globalData.mobile=res.data.user.mobile;
				  				uni.setStorageSync("userInfo", res.data.user);
				  				
				  			});
				  	}
				  }else{
				  	let token=uni.getStorageSync('mobile')||globalData.mobile;
				  	/*不能在重新获取用户信息*/
				  	that.main_getUserInfo(token,2).then(res=>{
				  		console.log('执行了重新获取数据用户的值',res.data.user);
				  		globalData.userInfo=res.data.user;
				  		//进来老用户进来设置手机号码，是用来判断老用户登录方式的凭证
				  		globalData.mobile=res.data.user.mobile;
				  		uni.setStorageSync("userInfo", res.data.user);
				  	});
				  }
			  },
       		 /*通过微信获取个人信息*/
       		 Old_getUserInfo:function(){
       		 	console.log('用户信息getUserInfo');
       		 	var that=this;
       		 	return new Promise((resolve,reject)=>{
       				var globalData=this.$options.globalData;
					console.log('globalData的值',globalData);
					var arr=that.main_getGlobal();
					console.log('arr的值',arr);
					let sync_mobile=uni.getStorageSync('mobile');
					//这里不管用户下次缓存
					if(sync_mobile){
						console.log('手机号sync_mobile的执行',sync_mobile);
						gyzjModel.prototype.getUserInfo(sync_mobile,2).then(data=>{
							console.log('手机号用户信息sync_mobile',data);
							globalData.userInfo=data.data.user;
							//进来老用户进来设置手机号码，是用来判断老用户登录方式的凭证
							globalData.mobile=data.data.user.mobile;
							uni.setStorageSync("userInfo", data.data.user);
						})
					}else{
						console.log('a无手机号sync_mobile的执行');
						gyzjModel.prototype.getUserInfo(arr.token,arr.type).then(data=>{
							console.log('无手机号sync_mobile',data.data.user);
							globalData.userInfo=data.data.user;
							uni.setStorageSync("userInfo", data.data.user);
						})
					}
					
       		 	})
       		 },
			 //登录
			 login() {
			 	// 1.wx获取登录用户code
			 	return new Promise((resolve,reject)=>{
			 		uni.login({
			 			provider: 'weixin',
			 			success: function(loginRes) {
			 				console.log('微信登录aa');
			 				let postData={
			 					code:loginRes.code,
			 					inviteCode:'',
			 				}
			 				resolve(gyzjModel.prototype.userLogin(postData));
			 			},
			 		});
			 	})
			 },
       		 /*jump函数判断登录*/
       		 jump:function(){
       		 	console.log('jump的执行a');
       		 	uni.reLaunch({
       		 		url:'/pages/start-up/start-up'
       		 	})
       		 },
       		 /*更新服务器用户信息*/
       		 updataUserInfo:function(postData,token){
       		 	gyzjModel.prototype.updataUserInfo(postData,token).then(res=>{
       		 		uni.hideLoading();
       		 	})
       		 },
       		},
       		onShow: function() {
       			console.log('App Show')
       		},
       		onHide: function() {
       			console.log('App Hide')
       		}
    }
</script>

<style>
	@import url("./static/style/app.css");
/* @import url("/components/gaoyia-parse/parse.css"); */
/*引入字体图标*/
	@import "./static/font-group-detail/iconfont.css";
	 
	button[type=success] {
		color: #FFFFFF;
		background-color: #0AC063;
	}
</style>
